package protobuf {
	import com.netease.protobuf.*;
	use namespace com.netease.protobuf.used_by_generated_code;
	import com.netease.protobuf.fieldDescriptors.*;
	import flash.utils.Endian;
	import flash.utils.IDataInput;
	import flash.utils.IDataOutput;
	import flash.utils.IExternalizable;
	import flash.errors.IOError;
	import protobuf.PRIZE_RANK_STRUCT_ITEM;
	import flash.utils.ByteArray;
	// @@protoc_insertion_point(imports)

	// @@protoc_insertion_point(class_metadata)
	public dynamic final class PRIZE_STRUCT_ITEM extends com.netease.protobuf.Message {
		/**
		 *  @private
		 */
		public static const NAME:FieldDescriptor$TYPE_BYTES = new FieldDescriptor$TYPE_BYTES("protobuf.PRIZE_STRUCT_ITEM.name", "name", (1 << 3) | com.netease.protobuf.WireType.LENGTH_DELIMITED);

		private var name$field:flash.utils.ByteArray;

		public function clearName():void {
			name$field = null;
		}

		public function get hasName():Boolean {
			return name$field != null;
		}

		public function set name(value:flash.utils.ByteArray):void {
			name$field = value;
		}

		public function get name():flash.utils.ByteArray {
			return name$field;
		}

		/**
		 *  @private
		 */
		public static const ENTRANTS:FieldDescriptor$TYPE_UINT32 = new FieldDescriptor$TYPE_UINT32("protobuf.PRIZE_STRUCT_ITEM.entrants", "entrants", (2 << 3) | com.netease.protobuf.WireType.VARINT);

		public var entrants:uint;

		/**
		 *  @private
		 */
		public static const RANK_LIST:RepeatedFieldDescriptor$TYPE_MESSAGE = new RepeatedFieldDescriptor$TYPE_MESSAGE("protobuf.PRIZE_STRUCT_ITEM.rank_list", "rankList", (3 << 3) | com.netease.protobuf.WireType.LENGTH_DELIMITED, protobuf.PRIZE_RANK_STRUCT_ITEM);

		[ArrayElementType("protobuf.PRIZE_RANK_STRUCT_ITEM")]
		public var rankList:Array = [];

		/**
		 *  @private
		 */
		override used_by_generated_code final function writeToBuffer(output:com.netease.protobuf.WritingBuffer):void {
			if (hasName) {
				com.netease.protobuf.WriteUtils.writeTag(output, com.netease.protobuf.WireType.LENGTH_DELIMITED, 1);
				com.netease.protobuf.WriteUtils.write$TYPE_BYTES(output, name$field);
			}
			com.netease.protobuf.WriteUtils.writeTag(output, com.netease.protobuf.WireType.VARINT, 2);
			com.netease.protobuf.WriteUtils.write$TYPE_UINT32(output, this.entrants);
			for (var rankList$index:uint = 0; rankList$index < this.rankList.length; ++rankList$index) {
				com.netease.protobuf.WriteUtils.writeTag(output, com.netease.protobuf.WireType.LENGTH_DELIMITED, 3);
				com.netease.protobuf.WriteUtils.write$TYPE_MESSAGE(output, this.rankList[rankList$index]);
			}
			for (var fieldKey:* in this) {
				super.writeUnknown(output, fieldKey);
			}
		}

		/**
		 *  @private
		 */
		override used_by_generated_code final function readFromSlice(input:flash.utils.IDataInput, bytesAfterSlice:uint):void {
			var name$count:uint = 0;
			var entrants$count:uint = 0;
			while (input.bytesAvailable > bytesAfterSlice) {
				var tag:uint = com.netease.protobuf.ReadUtils.read$TYPE_UINT32(input);
				switch (tag >> 3) {
				case 1:
					if (name$count != 0) {
						throw new flash.errors.IOError('Bad data format: PRIZE_STRUCT_ITEM.name cannot be set twice.');
					}
					++name$count;
					this.name = com.netease.protobuf.ReadUtils.read$TYPE_BYTES(input);
					break;
				case 2:
					if (entrants$count != 0) {
						throw new flash.errors.IOError('Bad data format: PRIZE_STRUCT_ITEM.entrants cannot be set twice.');
					}
					++entrants$count;
					this.entrants = com.netease.protobuf.ReadUtils.read$TYPE_UINT32(input);
					break;
				case 3:
					this.rankList.push(com.netease.protobuf.ReadUtils.read$TYPE_MESSAGE(input, new protobuf.PRIZE_RANK_STRUCT_ITEM()));
					break;
				default:
					super.readUnknown(input, tag);
					break;
				}
			}
		}

	}
}
